/*
 * Powered By [rapid-framework]
 * Web Site: http://www.rapid-framework.org.cn
 * Google Code: http://code.google.com/p/rapid-framework/
 * Since 2008 - 2011
 */

package com.nail.zhaogr.model;

import javax.persistence.*;

import org.hibernate.annotations.GenericGenerator;

import javax.validation.constraints.*;
import org.hibernate.validator.constraints.*;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import java.util.*;

import javacommon.base.*;
import javacommon.util.*;

import cn.org.rapid_framework.util.*;
import cn.org.rapid_framework.web.util.*;
import cn.org.rapid_framework.page.*;
import cn.org.rapid_framework.page.impl.*;

import com.nail.zhaogr.model.*;
import com.nail.zhaogr.dao.*;
import com.nail.zhaogr.service.*;
import com.nail.zhaogr.vo.query.*;

/**
 * @author badqiu email:badqiu(a)gmail.com
 * @version 1.0
 * @since 1.0
 */


@Entity
@Table(name = "complain")
public class Complain extends BaseEntity implements java.io.Serializable{
	private static final long serialVersionUID = 5454155825314635342L;
	
	//alias
	public static final String TABLE_ALIAS = "Complain";
	public static final String ALIAS_COMPLAIN_ID = "complainId";
	public static final String ALIAS_COMMENT_ID = "commentId";
	public static final String ALIAS_CONTENT = "content";
	
	//date formats
	

	//可以直接使用: @Length(max=50,message="用户名长度不能大于50")显示错误消息
	//columns START
    /**
     * complainId       db_column: complainId 
     */ 	
	
	private java.lang.Long complainId;
    /**
     * commentId       db_column: commentId 
     */ 	
	
	private java.lang.Long commentId;
    /**
     * content       db_column: content 
     */ 	
	@Length(max=500)
	private java.lang.String content;
	//columns END


	public Complain(){
	}

	public Complain(
		java.lang.Long complainId
	){
		this.complainId = complainId;
	}

	

	public void setComplainId(java.lang.Long value) {
		this.complainId = value;
	}
	
	@Id @GeneratedValue(generator="custom-id")
	@GenericGenerator(name="custom-id", strategy = "increment")
	@Column(name = "complainId", unique = true, nullable = false, insertable = true, updatable = true, length = 19)
	public java.lang.Long getComplainId() {
		return this.complainId;
	}
	
	@Column(name = "commentId", unique = false, nullable = true, insertable = true, updatable = true, length = 19)
	public java.lang.Long getCommentId() {
		return this.commentId;
	}
	
	public void setCommentId(java.lang.Long value) {
		this.commentId = value;
	}
	
	@Column(name = "content", unique = false, nullable = true, insertable = true, updatable = true, length = 500)
	public java.lang.String getContent() {
		return this.content;
	}
	
	public void setContent(java.lang.String value) {
		this.content = value;
	}
	
	
	private Comments comments;
	public void setComments(Comments comments){
		this.comments = comments;
	}
	
	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumns({
		@JoinColumn(name = "commentId",nullable = false, insertable = false, updatable = false) 
	})
	public Comments getComments() {
		return comments;
	}

	public String toString() {
		return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
			.append("ComplainId",getComplainId())
			.append("CommentId",getCommentId())
			.append("Content",getContent())
			.toString();
	}
	
	public int hashCode() {
		return new HashCodeBuilder()
			.append(getComplainId())
			.toHashCode();
	}
	
	public boolean equals(Object obj) {
		if(obj instanceof Complain == false) return false;
		if(this == obj) return true;
		Complain other = (Complain)obj;
		return new EqualsBuilder()
			.append(getComplainId(),other.getComplainId())
			.isEquals();
	}
}

